package com.margo.project.redis.atomic.action;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.support.atomic.RedisAtomicInteger;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RedisSequenceController {
	
	@Autowired
	private RedisAtomicInteger redisAtomicInteger;
	
	/**
	 * localhost:8080/redis/atomic
	 * @return
	 * @throws InterruptedException
	 */
	@RequestMapping(path="/redis/atomic")
	private String atomic() throws InterruptedException {
		int result=redisAtomicInteger.incrementAndGet();
		return String.valueOf(result);
	}
}
